package com.company.Insertionsort;

public class insertionsort {

    public static void main(String[] args) {

        int[] arrs = {1,232,34,1,23,22,2,334,52,121,4,545,1};

        sort(arrs);

        for (int arr : arrs) {

            System.out.println(arr);

        }

    }

    private static void sort(int[] arrs) {

        for (int a = 1 ; a < arrs.length ; a++)
        {

            int lingshi = arrs[a];

            int i = a;

            int j = i-1;

            while (j>= 0 && arrs[j] > lingshi)
            {
                arrs[i] = arrs[j];

                arrs[j] = lingshi;

                i--;
                j--;
            }

        }

    }


}
